﻿using System;
using System.Collections;
using UnityEngine;

// Token: 0x02000337 RID: 823
public class AssetLoader : BaseLoader
{
	// Token: 0x17000209 RID: 521
	// (get) Token: 0x060014D1 RID: 5329 RVA: 0x0008FEA0 File Offset: 0x0008E0A0
	// (set) Token: 0x060014D2 RID: 5330 RVA: 0x0008FEA8 File Offset: 0x0008E0A8
	public UnityEngine.Object loadObject { get; protected set; }

	// Token: 0x1700020A RID: 522
	// (get) Token: 0x060014D3 RID: 5331 RVA: 0x0008FEB4 File Offset: 0x0008E0B4
	// (set) Token: 0x060014D4 RID: 5332 RVA: 0x0008FEBC File Offset: 0x0008E0BC
	public bool isLoadEnd { get; private set; }

	// Token: 0x1700020B RID: 523
	// (get) Token: 0x060014D5 RID: 5333 RVA: 0x0008FEC8 File Offset: 0x0008E0C8
	// (set) Token: 0x060014D6 RID: 5334 RVA: 0x0008FED0 File Offset: 0x0008E0D0
	public bool initialized { get; protected set; }

	// Token: 0x060014D7 RID: 5335 RVA: 0x0008FEDC File Offset: 0x0008E0DC
	public void Init()
	{
		base.StartCoroutine(this._Init());
	}

	// Token: 0x060014D8 RID: 5336 RVA: 0x0008FEEC File Offset: 0x0008E0EC
	public virtual IEnumerator _Init()
	{
		if (this.initialized)
		{
			yield break;
		}
		this.initialized = true;
		if (this.isLoad)
		{
			if (this.isAsync)
			{
				yield return base.StartCoroutine(base.Load_Coroutine<UnityEngine.Object>(this.assetBundleName, this.assetName, delegate(UnityEngine.Object o)
				{
					this.loadObject = o;
				}, this.isClone, this.manifestFileName));
			}
			else
			{
				this.loadObject = base.Load<UnityEngine.Object>(this.assetBundleName, this.assetName, this.isClone, this.manifestFileName);
			}
		}
		this.isLoadEnd = true;
		yield break;
	}

	// Token: 0x060014D9 RID: 5337 RVA: 0x0008FF08 File Offset: 0x0008E108
	protected virtual IEnumerator Start()
	{
		if (this.initialized)
		{
			yield break;
		}
		yield return base.StartCoroutine(this._Init());
		yield break;
	}

	// Token: 0x060014DA RID: 5338 RVA: 0x0008FF24 File Offset: 0x0008E124
	protected virtual void OnDestroy()
	{
		if (!this.isLoadEnd)
		{
			return;
		}
		if (this.isBundleUnload && Singleton<AssetBundleManager>.IsInstance())
		{
			AssetBundleManager.UnloadAssetBundle(this.assetBundleName, this.isUnloadForceRefCount, this.manifestFileName, this.unloadAllLoadedObjects);
		}
	}

	// Token: 0x04001929 RID: 6441
	public string assetBundleName;

	// Token: 0x0400192A RID: 6442
	public string assetName;

	// Token: 0x0400192B RID: 6443
	public bool isAsync = true;

	// Token: 0x0400192C RID: 6444
	public bool isBundleUnload = true;

	// Token: 0x0400192D RID: 6445
	public bool isUnloadForceRefCount;

	// Token: 0x0400192E RID: 6446
	public bool unloadAllLoadedObjects;

	// Token: 0x0400192F RID: 6447
	public string manifestFileName;

	// Token: 0x04001930 RID: 6448
	[SerializeField]
	protected bool isLoad = true;

	// Token: 0x04001931 RID: 6449
	[SerializeField]
	protected bool isClone;
}
